import React from 'react'
import Qcenvets from "../utils/events"
import { useState} from "react"
function Top(props) {
  console.log(props);
  let [activeIndex,setACATIVEINDEX] = useState(0)
  const fn = (index)=> {
    Qcenvets.emit("sendfn",index)
    setACATIVEINDEX(index)
  }
  return (
    
    <div className='top'>
       {
         props.send && props.send.length ? props.send.map((item,index)=>{  

            return <div key={index} onClick={()=>fn(index)} className={index===activeIndex?"active":""}>{item.tit}</div>

         }):"暂无数据"
       }
    </div>
  )
}

export default Top